
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>购物车</title>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet">
</head>

<header>
    <div class="collapse bg-dark" id="navbarHeader">
        <div class="container">
            <div class="row">
            </div>
        </div>
    </div>
    <div class="navbar navbar-dark bg-dark shadow-sm">
        <div class="container">
            <a href="#" class="navbar-brand d-flex align-items-center">
                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" stroke="currentColor"
                    stroke-linecap="round" stroke-linejoin="round" stroke-width="2" aria-hidden="true" class="me-2"
                    viewBox="0 0 24 24">
                    <path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" />
                    <circle cx="12" cy="13" r="4" />
                </svg>
                <strong>c</strong>
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarHeader"
                aria-controls="navbarHeader" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
        </div>
    </div>
</header>

<body>

    {%if result==''%}<div style="margin:50px auto;">
        <form action="/jiesuan" method="post">
            <hr>
            {%for g in good%}
            <div class="row" style="display: flex;align-items: center;">
                <div class="col-md-2"></div>

                <div class="col-md-2">
                    <img src="{{g.image}}" style="width: 200px;height: 200px;">
                </div>
                <div class="col-md-2">
                    <h4><strong>{{g.name}}</strong></h4>
                </div>
                <div class="col-md-2">
                    <h4>{{g.price}}</h4>元/份
                </div>
                <div class="col-md-2">
                    <input type="number" name="{{g.good_id}}" value="0" min="0" />
                </div>

                <div class="col-md-2"></div>
            </div>
            <hr>
            {% endfor %}
            <div style="text-align: center;">
                <br>
                <input type="submit" value=" 立即结算 " />
            </div>
        </form>
    </div>
    {%else%}
    <div style="text-align: center;margin: 200px auto;">
        <h2>结算总价格：{{ result }}元</h2>
    </div>
    {%endif%}

</body>

<footer class="text-muted py-5">
    <div class="container">
        <p class="float-end mb-1">
            <a href="#">Back to top</a>
        </p>
        <p class="mb-1"></p>
        <p class="mb-0"><a href="/">返回首页</a></p>
    </div>
</footer>

</html>